import pymysql

conn = pymysql.connect(user='root', password='123456', host='master', port=3306, database='student')
cursor = conn.cursor()
t=cursor.execute("select id,name,age from student where clazz like %s and gender=%s",('理科%','男'))
print(t)
# print(cursor.fetchone()) 返回一条数据
# print(cursor.fetchmany(11)) 返回数条数据
# print(cursor.fetchall()) 返回所有数据
for i in range(t):
    print(cursor.fetchone())
cursor.close()
conn.close()
